<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="btn">加法</button>
    <button class="bttn">减法</button>
    <script>
        class Father {
            constructor(x, y) {
                this.x = x;
                this.y = y;

            }
            support() {
                console.log(+(this.x) + +(this.y));
            }
        }
        class Son extends Father {
            constructor(x, y) {
                super(x, y);
                // this.x = x;
                // this.y = y;
                var bttn = document.querySelector(".bttn")
                bttn.onclick = this.supot;
                var btn = document.querySelector(".btn")
                btn.onclick = this.support;
            }
            supot() {
                console.log(+(this.x) - +(this.y));
            }
        }
        var dowes = new Son(5, 8)
        dowes.supot()
        dowes.support()
    </script>
</body>

</html>